// array-like object
let object = {
	0: 1,
	1: 2,
	2: 3,
	length: 3
};

// build from object
let array = Array.from(object);
let array2 = Array.from(object, (x) => 2 * x);
let method = { handle: (x) => x + 2 }
let array3 = Array.from(object,
	function (x) { return this.handle(x) },
	method);
console.log(array, array2, array3);

// build from iterable objects
console.log(Array.from('imooc'));
const set = new Set(['a', 'b', 'c', 'a']);
console.log(Array.from(set));
const map = new Map([[1, 2], [2, 4], [4, 8]]);
console.log(Array.from(map));

// build from parameters
console.log(Array(3));
console.log(Array.of(3));
console.log(Array.of(1, 2, 3));
